#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
const int N = 2e6 + 10;
int a[N];
int n, m;
int sum[N];
int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        int l, r;
        cin >> l >> r;
        a[l + r] += 1;
    }
    for (int i = 1; i < N; i++)
    {
        sum[i] = sum[i - 1] + a[i];
    }
    while (m--) {
        int L, R;
        cin >> L >> R;
        L *= 2;
        R *= 2;
        cout << sum[R] - sum[L - 1] << endl;
    }
    return 0;
}